package com.example.tests;

import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

import java.util.Set;

import org.testng.annotations.Test;

public class ContactModificationTests extends TestBase {

	@Test
	public void testfirstContactCanBeModified() throws Exception {
		ContactObject validContact = new ContactObject()
				.setFirstname("zzzz")
				.setLastname("zzzz")
				.setAddress("zzzz")
				.setHome("zzzz")
				.setMobile("zzzz")
				.setWork("asdasd")
				.setEmail("asdas")
				.setEmail2("asdd@.eg")
				.setBday("19")
				.setBmonth("October")
				.setByear("1231")
				.setNewgroup("asdasd")
				.setAddress2("asdasd")
				.setPhone2("dsdfsd");
		Set <ContactObject> oldList= app.getContactHelper().getContacts();
		app.getContactHelper().modifyContact(1, validContact);
		Set <ContactObject> newList= app.getContactHelper().getContacts();
		verifyContactModified(oldList, validContact, newList);
	}
	
	private void verifyContactModified(Set<ContactObject> oldList,
			ContactObject validContact, Set<ContactObject> newList) {
		assertThat(newList.size(), equalTo(oldList.size()));
	}
}